from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import relationship
from app.core.database import Base

class KnowledgePoint(Base):
    __tablename__ = "knowledge_points"
    
    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    name = Column(String(100), nullable=False)
    description = Column(String(500), nullable=True)
    grade_id = Column(Integer, ForeignKey("grades.id"), nullable=False)
    
    grade = relationship("Grade", back_populates="knowledge_points")
    questions = relationship("Question", back_populates="knowledge_point_rel")